package com.bps.zzant.services;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bps.zzant.dao.OrderDAO;
import com.bps.zzant.model.OrderGarment;

@Service
@Transactional

public class OrderServiceImpl implements OrderService {
	
	@Autowired
	OrderDAO orderDAO;


	public OrderDAO getOrderDAO() {
		return orderDAO;
	}

	public void setOrderDAO(OrderDAO orderDAO) {
		this.orderDAO = orderDAO;
	}

	public void updateGarmentOrder(OrderGarment order) {
		orderDAO.updateGarmentOrder(order);

	}

	public void deleteGarmentOrder(OrderGarment order) {
		// TODO Auto-generated method stub

	}

	public void saveGarmentOrder(OrderGarment order) {
		orderDAO.saveGarmentOrder(order);
	}

	public OrderGarment getOrderById(int orderId){
		return orderDAO.getOrderById(orderId);
	}
	
	public List<OrderGarment> getOrderList(int customerId, String orderStatus){
		return orderDAO.getOrderList(customerId, orderStatus);
	}
	
	public List<OrderGarment> getOrderList(String ordersStatus, Date startingDate, Date endDate){
		return orderDAO.getOrderList(ordersStatus, startingDate, endDate);
	}
	
	public List<OrderGarment> getOrderList(String customerName, String ordersStatus, Date startingDate, Date endDate){
		 customerName = "%"+customerName + "%";
		return orderDAO.getOrderList(customerName, ordersStatus, startingDate, endDate);
	}
	
	public List<OrderGarment> getOrderList(String customerName, String ordersStatus){
		customerName = "%"+customerName + "%";
		return orderDAO.getOrderList(customerName, ordersStatus);
	}
	
	public List<OrderGarment> getOrderList(String customerName){
		return orderDAO.getOrderList(customerName);
	}
}
